﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AgentQltyEdit.aspx.cs" Inherits="IHISCETeim.Web.AgentSys.SvrMgr.AgentQltyEdit" %>

<div class="pageContent AgentQltyEditFrom">
	<form method="post" action="SvrMgr/AgentQltyEdit.aspx?ajaxmethod=edit&isAffiliated=<%=isAffiliated %>&QltyId=<%=QltyId %>" class="pageForm required-validate" onsubmit="return validateCallbackAgentQltyEdit(this, navTabAjaxDone);" >
		<div class="pageFormContent" layoutH="56">
                <h2 style=" padding:0px 0px 5px 6px; border-bottom:1px solid #B8D0D6;">1.基本信息</h2>
                    <div style="width:760px">
			            <p>
				            <label>品 情 号：</label>
				            <input name="ClaimsNumber" type="text" class="" readonly value="" />
			            </p>
			            <p>
				            <label>发行日期：</label>
				            <input name="IssueDate" class="required date" format="yyyy-MM-dd HH:mm" type="text" value="" alt=""/>
			            </p>
                        <div style="clear:both;"></div>
                        <label>服务担当：</label>
                        <input name="SvrInfo" type="text" class="" readonly style="width:300px" value="<%=GetSvrInfo() %>" />
                        
                    </div>
                    <div class="divider"></div>
                    <div style="float:left; width:760px" > 
			            <p>
				            <label>经 销 商：</label>
                            <input name="AgentName" type="text" readonly class="required textInput" value="" />
			            </p>
                        <p>
				            <label>机号：</label>
				            <input id="AddAgentQltySerialNumber" name="SerialNumber" class="required" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>用户：</label>
				            <input name="CustomerName" class="required" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>用户手机：</label>
				            <input name="CustomerMobile" class="required" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>交机日：</label>
				            <input name="IntoDate" class="date" format="yyyy-MM-dd HH:mm" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>地点：</label>
				            <input name="IntoAddress" class="" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>故障日：</label>
				            <input name="FaultDate" class="date required" format="yyyy-MM-dd HH:mm" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>机型：</label>
				            <input name="MachineType" class="" type="text"  value="" alt=""/>
			            </p>
                        <p>
				            <label>工作小时：</label>
				            <input name="WorkHour" class="required" type="text"  value="0" alt=""/>
			            </p>
                        <p>
				            <label>报告人：</label>
				            <input name="ReportUser" class="" type="text"  value="" alt=""/>
			            </p>
                         <p>
				            <label>联系电话：</label>
				            <input name="ReportTel" class="" type="text"  value="" alt=""/>
			            </p>
                         <p>
				            <label>损坏部品序列号或钢号：</label>
				            <input name="DamagePartsNumber" class="" type="text"  value="" alt=""/>
			            </p>
                    </div>
                    <div style="float:left;width:380px; padding:5px 0px;" class="">
                         <p>
                             <label>机器性质：</label>
                             <select name="MacNature" class="">
                                 <option value="代理商库存机">代理商库存机</option>
                                 <option value="IHISCE样机">IHISCE样机</option>
                                 <option value="终端客户机" selected>终端客户机</option>
                             </select>
                        </p>
                        <p>
                             <label>作业内容：</label>
                             <select name="IntoConditi" class="">
                                 <option value="土方" selected>土方</option>
                                 <option value="砂石">砂石</option>
                                 <option value="采石">采石</option>
                                 <option value="挖砂">挖砂</option>
                                 <option value="造园">造园</option>
                                 <option value="其他">其他</option>
                             </select>
                        </p>
                        <p>
                             <label>特别附件及规格：</label>
                             <select name="IntoSpecial" class="">
                                 <option value="破碎管路">破碎管路</option>
                                 <option value="破碎专用">破碎专用</option>
                                 <option value="加宽铲斗">加宽铲斗</option>
                                 <option value="加长臂">加长臂</option>
                                 <option value="其他">其他</option>
                                 <option value="标准规格" selected>标准规格</option>
                             </select>
                        </p>
                    </div>
                 <div style="clear:both;"></div>
                 <h2 style=" padding:0px 0px 5px 6px; border-bottom:1px solid #B8D0D6; clear:both; margin-top:15px;">2.故障信息</h2>
                    
                    <div style="float:left; width:380px; margin-right:10px;"> 
                        <label style="width:250px!important;">故障描述(工况、故障部位、故障现象)：</label>
                        <div style="clear:both;margin-bottom: 5px;"></div>
				        <textarea name="FaultDescription" style="height:205px; width:375px;" ></textarea>

                        <div style="clear:both;margin-bottom: 5px;"></div>
                        <label style="width:250px!important;">故障推定原因：</label>
                        <div style="clear:both;margin-bottom: 5px;"></div>
				        <textarea name="FaultReason"  style="height:205px; width:375px;" ></textarea>

                        <label style="width:250px!important;">结论：</label>
                        <div style="clear:both;margin-bottom: 5px;"></div>
				        <textarea name="ProcessMode" style="height:265px; width:375px;" ></textarea>
                    </div>
                    <div style="float:left;width:445px;">
                        <label style="width:250px!important;">故障描述(工况、故障部位、故障现象)：</label>
                        <div style="clear:both;margin-bottom: 5px;"></div>
                         <asp:repeater id="rpImgs" runat="server">                    
                            <ItemTemplate>
                                <div style="float:left; height:210px; width:210px; margin-bottom:25px;">
                                    <img  id="AgentQltyEditimgShow<%# Eval("id") %>" src="<%# ResolveClientUrl(Eval("IMGRelatively").ToString()) %>"  Width="200" Height="150"/>                                                                   
                                    <div style="clear:both;margin-bottom:2px;"></div>                                   
                                    <input type="file" name="filedata" id="AgentQltyEditimgRelativelyupload<%# Eval("id") %>" uploadify="uploadify" clientId="AgentQltyEditimgShow<%# Eval("id") %>,AgentQltyEditimgRelatively<%# Eval("id") %>" dirtype="4" foldername="<%=User.Department %>" onUploadSuccess="onAgentQltyAgentQltyEditUploadImgSuccess" fileTypeDesc="只能上传图片" fileTypeExts="*.jpg;*.gif;*.jpeg;*.png;*.bmp" fileSizeLimit="1MB"/>
                                    <div style="clear:both;margin-bottom:2px;"></div>
                                    <input type="hidden"  id="AgentQltyEditimgRelatively<%# Eval("id") %>" name="imgRelatively" value="<%# ResolveClientUrl(Eval("IMGRelatively").ToString()) %>" />
                                    <input type="text" name="ImgTitle" style="width:200px" value="<%# Eval("Title") %>" />                       
                                </div>
                            </ItemTemplate>
                        </asp:repeater>

                        <div style="height:2px; clear:both; margin-bottom:-25px;"></div>
                        <div style=" width:210px;">
                            <label style="width:250px!important;">其它文件上传(不能超过10M)：</label>                            
                            <div style="clear:both;margin-bottom:2px;"></div>
                            <input type="hidden" name="imgRelatively" id="AgentQltyEditimgRelativelyOther" value="<%=GetUploadFile(6) %>" />
                             <input type="hidden" name="ImgTitle"  value="其它文件" />
                            <input type="file" name="filedata" id="AgentQltyEditimgRelativelyuploadOther" uploadify="uploadify" clientId="AgentQltyEditimgRelativelyOther" dirtype="4" foldername="<%=User.Department %>" onUploadSuccess="onAgentQltyAgentQltyEditUploadFileSuccess" fileSizeLimit="10MB"/>
                        </div>
                    </div>
                <div style="clear:both;"></div>
                <h2 style=" padding:0px 0px 5px 6px; border-bottom:1px solid #B8D0D6; clear:both; margin-top:15px;">3.部品需求(只有填写配件号的行才会被保存)</h2>
                    <div style="padding:5px 0px; margin-bottom:5px;">
                             <p>
				                <label>部品收件人：</label>
				                <input name="PartsAcceptName" class="" type="text"  value="" alt=""/>
			                </p>
                            <p>
				                <label>联系电话：</label>
				                <input name="PartsAcceptTel" class="" type="text"  value="" alt=""/>
			                </p>
                           <p>
				                <label>期望到货时间：</label>
				                <select name="PartsAcceptDate">
                                    <option value="">请选择...</option>
                                    <option value="1-2天">1-2天</option>
                                    <option value="2-3天">2-3天</option>
                                    <option value="3天-1周">3天-1周</option>
                                    <option value="1周以上">1周以上</option>                                   
				                </select>
			                </p>
                          <div style="clear:both;"></div>
				            <label>部品收货地址：</label>
				            <input  name="PartsAcceptAddress" class="" type="text" size="100"  value="" alt=""/>
			       </div>
                    <div style="clear:both; "></div>
                    <table class="list"  style="width:100%" >
                       <thead>
                         <tr>                                    
                                    <th width="150px">配件号</th>
                                    <th width="150px">配件名</th>
                                    <th width="150px">数量</th>
                                    <th width="250px">配件需求</th>
                          </tr>                                
                        </thead>
                        <tbody>
                        <asp:repeater id="rpParts" runat="server">                    
                            <ItemTemplate>
                                 <tr>                                  
                                     <td>
                                         <input type="text" name="ItemCode" id="dwz.AgentQltyEdit.ItemCode<%# Eval("ID") %>" class=""  showinputid="rpParts_Dscription_AgentQltyEdit<%# Eval("ID") %>" autocompletehref="<%=AgentAutoCompleteUrl %>?ajaxmethod=getoitmlist&showtype=102" swidth="300" value="<%# Eval("ItemCode") %>" />
                                         <a class="btnLook" href="/MachineSys/SAPItemListLookUp.aspx?inputtag=<%# Eval("ID") %>" lookupgroup="AgentQltyEdit" maxable="false" width="600" resizable="false" title="选择配件">
                                            <hi:text key="查找带回" />
                                        </a>
                                        
                                     </td>
                                     <td>
                                          <input type="text" id="dwz.AgentQltyEdit.ItemName<%# Eval("ID") %>"  name="Dscription" value="<%# Eval("Dscription") %>"/>
                                     </td>
                                     <td><input type="text" name="Quantity" value="<%# Eval("Quantity") %>"/></td>
                                     <td>
                                         <select name="PartsDemand">
                                             <option value="索赔发货" <%# Eval("PartsDemand").ToString()=="索赔发货"?"selected":"" %>>索赔发货</option>
                                             <option value="索赔发货(补件)" <%# Eval("PartsDemand").ToString()=="索赔发货(补件)"?"selected":"" %>>索赔发货(补件)</option>
                                             <option value="索赔加急发货" <%# Eval("PartsDemand").ToString()=="索赔加急发货"?"selected":"" %>>索赔加急发货</option>
                                             <option value="服务支持件" <%# Eval("PartsDemand").ToString()=="服务支持件"?"selected":"" %>>服务支持件</option>
                                             <option value="索赔结算" <%# Eval("PartsDemand").ToString()=="索赔结算"?"selected":"" %>>索赔结算</option>
                                             <option value="备用件发货" <%# Eval("PartsDemand").ToString()=="备用件发货"?"selected":"" %>>备用件发货</option>
                                             <option value="供应商发货" <%# Eval("PartsDemand").ToString()=="供应商发货"?"selected":"" %>>供应商发货</option>
                                         </select>                                                                              
                                     </td>
                                 </tr>
                             </ItemTemplate>                           
                        </asp:repeater>
                        </tbody>
                      </table>
                
                <div style="clear:both;"></div>
                <h2 style=" padding:0px 0px 5px 6px; border-bottom:1px solid #B8D0D6; clear:both; margin-top:15px;">4.IHISCE服务担当处理</h2>
                    <p>
				          <label>报告类型：</label>
                          <input name="ReportType" type="text" readonly  />
			        </p>                    
                    <div style="clear:both;"></div>
                    <label style="width:250px!important;">IHISCE服务部品情回复、对策与结果：</label>
                    <div style="clear:both;margin-bottom: 5px;"></div>
				    <textarea name="SvrResult" style="height:50px; width:405px;" readonly ></textarea>
                    <div style="clear:both;margin-bottom: 5px;"></div>
                     <p>
				        <label>驳回原因：</label>
                        <input name="CancelReason" readonly  type="text"  value=""  />
			         </p>
                    <div style="clear:both;margin-bottom: 5px;"></div>
                    <p>
				        <label>配件发送日期：</label>
                        <input name="PartsSendDate" readonly type="text"   />
			         </p>
                    <p>
				        <label>配件发送方式：</label>
                        <input name="PartsSendType" readonly type="text"   />
			         </p>
             <div style="clear:both;">驳回记录:</div>
                     <table class="list"  style="width:100%" >
                       <thead>
                         <tr>                                    
                                    <th width="150px">驳回时间</th>
                                    <th width="150px">驳回人</th>
                                    <th >驳回原因</th>
                          </tr>                                
                        </thead>
                        <tbody>
                        <asp:repeater id="rpReject" runat="server">                    
                            <ItemTemplate>
                                 <tr>                                  
                                     <td>
                                         <%# Eval("RejectDate")%>                                  
                                     </td>
                                     <td>
                                         <%# Eval("RejectRealName")%>
                                     </td>
                                     <td><%# Eval("RejectReason")%></td>
                                 </tr>
                             </ItemTemplate>                           
                        </asp:repeater>
                        </tbody>
                      </table>
		</div>
		<div class="formBar">
			<ul>	
                <%if (obj.ClaimState == IHISCETeim.Web.ClaimState.品情再确认.ToString()) { %>
                <li id="AgentQltyEdit_BtnSave" ><div class="buttonActive"><div class="buttonContent"><button type="submit"> 提 交 </button></div></div></li>
                <%} %>	
                 <%if (obj.ClaimState == IHISCETeim.Web.ClaimState.品情已确认.ToString()) { %>
                <li id="AgentQltyEdit_BtnSave" ><div class="buttonActive"><div class="buttonContent"><button type="submit">生成附属品情</button></div></div></li>
                <%} %>			
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        var $Qltyjson = eval(<%= Newtonsoft.Json.JsonConvert.SerializeObject(obj)%>);
        //alert($Qltyjson.QltyId)
        var $dateColumn = "IssueDate,IntoDate,FaultDate"
        for (var itm in $Qltyjson) {
            var $val = $Qltyjson[itm];
            if ($dateColumn.indexOf(itm) >= 0){
                //$val = formatterdate($Qltyjson[itm]);
                $val = $Qltyjson[itm].replace("T", " ").substring(0, 16);
                <%if (isAffiliated ==0) {%>
                if (itm == "IssueDate") {
                    $val="<%=System.DateTime.Now.ToString("yyyy-MM-dd HH:mm")%>"
                }
                <%}%>
            }
            if ($(".AgentQltyEditFrom").find("[name='" + itm + "']").is(":checkbox"))
                $(".AgentQltyEditFrom").find("[name='" + itm + "']").attr("checked", $val);
            else
                $(".AgentQltyEditFrom").find("[name='" + itm + "']").val($val);

        }
    })


    function onAgentQltyAgentQltyEditUploadImgSuccess(file, data, response) {
        if (!response)
            return false;
        data = eval("(" + data + ")");
        if (!data.uploadResult) {
            alert(data.errMsg);
            return;
        }
        var $imgUploadPath = data.filePath;
        var $trageIds = data.customerInfo.split(",");
        $("#" + $trageIds[0]).attr("src", $imgUploadPath);
        $("#" + $trageIds[1]).val($imgUploadPath);
    }
    function onAgentQltyAgentQltyEditUploadFileSuccess(file, data, response) {
        if (!response)
            return false;
        data = eval("(" + data + ")");
        if (!data.uploadResult) {
            alert(data.errMsg);
            return;
        }
        var $imgUploadPath = data.filePath;
        var $trageId = data.customerInfo;
        $("#" + $trageId).val($imgUploadPath);
    }
    
    //新增时需要处理 金额是否与合同金额一致
    function validateCallbackAgentQltyEdit(form, callback) {
        var $form = $(form);

        $("#AgentQltyEdit_BtnSave").find("button").attr("disabled", "disabled").html("请稍侯......");
        setTimeout(function () { $("#AgentQltyEdit_BtnSave").find("button").removeAttr("disabled").html(" 提 交 "); }, 5000);

        return validateCallback(form, callback);
    }
</script>
